﻿namespace KinonekoSoftware.Studio.Enums
{
    public static class EnumStatic
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static int Cast<T>(T value) where T : struct, Enum => Convert.ToInt32(value);

        
        /// <summary>
        /// 
        /// </summary>
        /// <param name="value"></param>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public static T IntToEnum<T>(int value) where T : struct, Enum => (T)Enum.ToObject(typeof(T), value);
    }
}